#ifndef LOG_MESSAGE_H
#define LOG_MESSAGE_H

#include <cstdint>
#include <vector>
#include <string>
using namespace std;

struct FileHeader
{
    char     fmtTag[4];   // The format string, always "TLOG"
    uint16_t version;     // The version number, begin from 1
    uint16_t size;        // The latter bytes of LogFile header part
    uint32_t type;        //0: Log data type; 1: Log Config type;
                          // 2: Reserved; 3: Filter type; 4: Bitmap type
};
struct TargetAddr
{
    uint32_t ip;          // ip address
    uint16_t port;        // port
    uint16_t rsv;         // reserved
};
struct LogDataHeader
{
    uint32_t grp_id :16;
    uint32_t log_code :16;
    uint32_t n_logbytes :16;
    uint32_t reserved :16;
    uint32_t seq_num;
    uint32_t tv_sec;
    uint32_t tv_usec;
    uint32_t frameNumber :16;
    uint32_t subframeNumber :16;
    uint32_t OffsetTime;
};

struct LogData
{
    TargetAddr addr;
    LogDataHeader ldh;
    char* mem;
};

int ReadLogs(string filename, vector<LogData>& logs);
    
#endif
